<?
   require("../../configuracion.php");
   $idSysSection = $sectionCampEmail;
   $path = "../../";
   require("../../application-top.php");
   
   $action          = $_POST['action'];
   $sectionname     = $_POST['sectionname'];
   $sectioncampaign = $_POST['sectioncampaign'];
   $redirecturl     = $_POST['redirecturl'];
   $mensaje 		= "";
   
   if ($action == "newsection") { 
   		$query  = " INSERT INTO track_EmailSections ";
		$query .= " (sectionCampaign, sectionName, sectionRedirectURL, id_SysUser, fechaSection) ";
		$query .= " VALUES     ('".$sectioncampaign."', '".$sectionname."', ";
		$query .= " '".$redirecturl."', '".$_SESSION[$appkey."id_SysUser"]."', GETDATE())";
		$result = mssql_query ($query);
		$row = mssql_fetch_object($result);
		$mensaje = "<br><font color='#0000FF'><strong>Secci&oacute;n agregada !</strong></font><br>";
	}
   
?>
<html>
<head>
  <title><?= $instanciaECRM ?></title>
  <link rel="stylesheet" href="../../styles/style.css" type="text/css">
</head>
<body leftmargin="0" class="mainBackground" topmargin="0" marginwidth="0" marginheight="0">
<table width="100" border="0" cellpadding="0" cellspacing="0">
  <tr><td><img src="../../images/headerBar.gif" width="590" height="60" alt=""></td></tr>
  <tr>
    <td><table width="800" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td bgcolor="#FFFFFF" valign="top" height="400">

<table border="0" cellpadding="5" cellspacing="0" width="750">
  <tr><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr><td colspan="2"><img src="images/spacer.gif" height="10" width="1" alt=""></td></tr><tr><td><strong class="pageTitle">Campa&ntilde;as E-mail</strong><br><strong class="pageSubtitle">Administrador Secciones y Tracking</strong></td><td align="right"><a href="http://www.cacto.com/" target="_blank"><img src="../../images/trademarkCacto.gif" alt="Cacto" border="0"></a><br>
<strong class="systemTitle"><?= $instanciaECRM ?></strong><br>Perfil <strong><?= $PerfilUsuario ?></strong></td></tr>
  </table></td></tr>
  <tr><td>
    <table border="0" cellpadding="5" cellspacing="1" class="mainTableBG">
      <tr class="answerCellBG">
        <td><img src="../../images/icArrowGo.gif" height="13" width="13" alt=""></td>
        <td><a href="email_admin.php" target="content">Regresar</a></td>
          </tr>
        </table>
      </td></tr>
      <tr><td colspan="2"><img src="../images/spacer.gif" height="10" width="1" alt=""></td></tr>
      <tr>
	  <td>
	  
	  
	  <br>
	  <strong class="pageSubtitle">Secciones en Emailing</strong><strong class="pageSubtitle"> y Tracking</strong><br>
	  <font color="#999999">Secciones o ligas habilitadas para piezas de emailing.</font>
	  <?= $mensaje ?>
	  <br>
	  <br>
			<table border='0' cellpadding='5' cellspacing='1' class='secTableBG'>
			  <tr class="mainTableBG">
				<td colspan="5"><strong class="secTableTitle">Secciones</strong></td>
			  </tr>
			  <tr class="titleBarTableBG">
				<td><strong class="secTableTitle">idSeccion</strong></td>
				<td><strong class="secTableTitle">Nombre Secci&oacute;n</strong></td>
				<td><strong class="secTableTitle">Redirect URL</strong></td>
				<td><strong class="secTableTitle">Clasificaci&oacute;n Secci&oacute;n</strong></td>
				<td><strong class="secTableTitle">Fecha Activaci&oacute;n</strong></td>
			  </tr>
			<?
			$lineaPar = 1;
			
			$query  =" SELECT  * ";
			$query .= " FROM   track_EmailSections WITH(NOLOCK) ";
			//$query .= " ORDER BY fechaSection DESC, id_EmailSection; ";
			$resultSet = mssql_query($query);
			while ($row = mssql_fetch_object($resultSet)){
			
					if ($lineaPar == 1) {
						$classLinea = "answerCellBG";
						$lineaPar = 0;
						} else{
						$classLinea = "conceptCellBG";
						$lineaPar = 1;
						}	
						
				?>
			  <tr class="<?= $classLinea ?>">
				<td align="right"><a href="email_sectionsample.php?id=<?= $row->id_EmailSection ?>" title="Ver Ejemplo" target="_blank"><?= $row->id_EmailSection ?></a></td>
				<td><?= $row->sectionName ?></td>
				<td><a href="<?= $row->sectionRedirectURL ?>" target="_blank"><?= $row->sectionRedirectURL ?></a></td>
				<td><?= $row->sectionCampaign ?></td>
				<td><?= date('d/m/Y',strtotime($row->fechaSection))?></td>
			  </tr>
			<?
			}
			?>  
			</table>
			<img src="../../images/spacer.gif" height="10" width="1" alt="">
			<table border="0" cellpadding="5" cellspacing="1" class="mainTableBG">
			  <tr class="answerCellBG">
			    <td><img src="../../images/icArrowGo.gif" height="13" width="13" alt=""></td>
			    <td><a href="#new">Nueva Secci&oacute;n</a></td>
			    <td><img src="../../images/icArrowGo.gif" height="13" width="13" alt=""></td>
			    <td><a href="email_sectionsample.php?id=0" target="_blank">Ver Ejemplo y Tracking</a></td>
			    </tr>
			  </table>
			<br>
			<hr>
			<a name="new">
			<form action="email_sectionsadmin.php" method="post" name="formSection">
			<input name="action" type="hidden" value="newsection">
			<table border='0' cellpadding='5' cellspacing='1' class='secTableBG'>
			  <tr class="mainTableBG">
				<td colspan="2"><strong class="secTableTitle">Nueva Secci&oacute;n</strong></td>
			  </tr>
			  <tr>
				<td class="conceptCellBG">Nombre Secci&oacute;n:</td>
				<td class="answerCellBG"><input name="sectionname" type="text" size="60"></td>
			  </tr>
			  <tr>
				<td class="conceptCellBG">URL Redirect:</td>
				<td class="answerCellBG"><input name="redirecturl" type="text" value="http://" size="100"></td>
			  </tr>
			  <tr>
				<td class="conceptCellBG">Clasificaci&oacute;n Secci&oacute;n:</td>
				<td class="answerCellBG"><input name="sectioncampaign" type="text" size="60"></td>
			  </tr>
			  <tr>
				<td class="answerCellBG" colspan="2"><input name="Agregar" type="submit" value="Agregar Secci&oacute;n"></td>
			  </tr>
			</table>
			</form>
			  
			  </td></tr>
    </table>
  </td>
  </tr>
</table>
          
          </td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<br>
<br>
<table width="750" border="0">
  <tr>
    <td align="right"><span class="copyright"><?= $copyright ?></span></td>
  </tr>
</table>
</body>
</html>
